<template>
    <el-card shadow="nvner" class="footer_btn">
        <el-button v-if="currentStep == 1" @click="onBack">取消</el-button>
        <el-button v-else @click="onPrev">上一步</el-button>
        <el-button v-if="currentStep != step" type="primary" @click="onNext(currentStep)">下一步</el-button>
        <template v-else>
            <el-button v-if="pageType != 'look'" type="primary" @click="onNext(currentStep)">保存</el-button>
            <el-button v-else type="primary" @click="onBack">返回</el-button>
        </template>
    </el-card>
</template>

<script setup lang="ts">
import { withDefaults, defineProps } from 'vue';
import { useRouter, useRoute } from 'vue-router';
interface Props {
    step: any;
    currentStep: any;
}
const props = withDefaults(defineProps<Props>(), {
    step: 1,
    currentStep: 1
});
const emit = defineEmits(['prev', 'next']);
const router = useRouter();
const route = useRoute();
const pageType = route.query.type;
const onBack = () => {
    router.back();
};
const onPrev = () => {
    emit('prev');
};
const onNext = () => {
    emit('next');
};
</script>

<style scoped lang="scss">
.footer_btn {
    margin-top: 16px;
    text-align: right;

    :deep(.el-card__body) {
        padding: 11px 24px;
    }
}
</style>
